package ch09_io.designpattern;

import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

/**
 *
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public class DesignMain {
    // 类模式适配器
    @Test
    public void adapter() throws Exception {
        File file = new File(System.getProperty("user.dir")
                + "/src/main/java/ch09_io/designpattern/DesignMain.java");
        FileInputStream fis = new FileInputStream(file);
        InputStreamReader isr = new InputStreamReader(fis);
        int b;
        while ((b = isr.read()) != -1) {
            System.out.print((char) b);
        }
        fis.close();
        isr.close();
    }
}
